perm filename CROSS.DOC[UP,DOC] blob
sn#500394 filedate 1980-04-07 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00048 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00008 00002 CROSS
C00010 00003 CROSS-Microcomputer cross assembler 1
C00013 00004 CROSS-Microcomputer cross assembler 2
C00016 00005 CROSS-Microcomputer cross assembler 3
C00019 00006 CROSS-Microcomputer cross assembler 4
C00024 00007 CROSS-Microcomputer cross assembler 5
C00026 00008 CROSS-Microcomputer cross assembler 6
C00032 00009 CROSS-Microcomputer cross assembler 7
C00037 00010 CROSS-Microcomputer cross assembler 8
C00042 00011 CROSS-Microcomputer cross assembler 9
C00044 00012 CROSS-Microcomputer cross assembler 10
C00047 00013 CROSS-Microcomputer cross assembler 11
C00049 00014 CROSS-Microcomputer cross assembler 12
C00054 00015 CROSS-Microcomputer cross assembler 13
C00058 00016 CROSS-Microcomputer cross assembler 14
C00061 00017 CROSS-Microcomputer cross assembler 15
C00066 00018 CROSS-Microcomputer cross assembler 16
C00070 00019 CROSS-Microcomputer cross assembler 17
C00073 00020 CROSS-Microcomputer cross assembler 18
C00076 00021 CROSS-Microcomputer cross assembler 19
C00079 00022 CROSS-Microcomputer cross assembler 20
C00082 00023 CROSS-Microcomputer cross assembler 21
C00083 00024 CROSS-Microcomputer cross assembler 22
C00087 00025 CROSS-Microcomputer cross assembler 23
C00089 00026 CROSS-Microcomputer cross assembler 24
C00091 00027 CROSS-Microcomputer cross assembler 25
C00092 00028 CROSS-Microcomputer cross assembler 26
C00095 00029 CROSS-Microcomputer cross assembler 27
C00100 00030 CROSS-Microcomputer cross assembler 28
C00102 00031 CROSS-Microcomputer cross assembler 29
C00105 00032 CROSS-Microcomputer cross assembler 30
C00109 00033 CROSS-Microcomputer cross assembler 31
C00112 00034 CROSS-Microcomputer cross assembler 32
C00114 00035 CROSS-Microcomputer cross assembler 33
C00118 00036 CROSS-Microcomputer cross assembler 34
C00122 00037 CROSS-Microcomputer cross assembler 35
C00125 00038 CROSS-Microcomputer cross assembler 36
C00127 00039 CROSS-Microcomputer cross assembler 37
C00129 00040 CROSS-Microcomputer cross assembler 38
C00131 00041 CROSS-Microcomputer cross assembler 39
C00134 00042 CROSS-Microcomputer cross assembler 40
C00137 00043 CROSS-Microcomputer cross assembler 41
C00140 00044 CROSS-Microcomputer cross assembler 42
C00143 00045 CROSS-Microcomputer cross assembler 43
C00146 00046 CROSS-Microcomputer cross assembler 44
C00149 00047 CROSS-Microcomputer cross assembler i
C00154 00048 CROSS-Microcomputer cross assembler ii
C00156 ENDMK
C⊗;
CROSS
7 April 1980
The material used in this specification, including but not limited to
construction times and operating speeds, is for informational purposes only.
All such material is subject to change without notice.
This document describes the operational procedures for CROSS, an assembler
which operates on the DECsystem-10/20 systems, translating source code for
6502, 6800, 8080, 8085, Z80, 1802, F8[future], and 8008 micro-processors into
binary files suitable for absolute load.
All of the appendices to this manual and the index were constructed by Joseph
M. Newcomer, Carnegie-Mellon University Computer Science Department.
CROSS-Microcomputer cross assembler 1
1. Introduction
CROSS is an assembler which operates on the DECsystem-10/20 and assembles
code for many currently available micro-processors. With the exception of the
variations listed in this manual, CROSS implements the features of the PDP-11
macro assembler for RSX-11D. No attempt was made to provide source
compatibility between CROSS and other micro- processor assemblers. Rather,
CROSS has been designed to provide consistent, powerful features for all of the
mnemonics associated with each micro-processor.
While CROSS is designed to be language compatible with the MACRO-11 language,
its PDP-10 operating environment necessitates a PDP-10 style operating
procedure.
Expression evaluation has been updated to provide the following features:
- Default radix is decimal.
- @<expr> indicates octal radix, same as to ↑O<expr>
- %<expr> indicates binary (6502/6800 only), same as to ↑B<expr>
- %nn indicates register value nn (all others)
- $<expr> indicates hexidecimal radix
- <expr>↑ indicates that the evaluated expression is to be divided by
256. (high byte)
The assembler makes two passes over the source, outputting the binary and
listing files during pass two and appending a symbol or cross reference table
to the listing file. PDP-10 memory is dynamically allocated for large symbol
table storage and macro storage.
Introduction
CROSS-Microcomputer cross assembler 2
2. Syntax differences
The syntax of CROSS is more compatible with that of MACRO-11 than that of
most manufacturer's assemblers. This means that you will not be able to
compile straight 8080, Z80, 6502 or 6800 code with this assembler. However,
the transliterations are reasonably straightforward and are described for each
machine in the appendices. In general, you must specify registers with a
%-directive.
The machine which differs most from the manufacturer's specification of an
assembler syntax is the Zilog Z80. This is because CROSS implements the Z80
syntax as a superset of the 8080 syntax. Consequently, the syntax of most
operations follows that of the 8080. In addition, some Z80 mnemonics
conflicted with 8080 mnemonics; the Z80 has been assigned new mnemonics where
these conflicts existed. Any Z80 operation which has no 8080 counterpart has
also been assigned a mnemonic; some correspond to the Zilog specification
(wherever this was possible) and most do not. Consequently, a complete
cross-reference between the Zilog syntax and the CROSS transliteration has been
provided.
Syntax differences
CROSS-Microcomputer cross assembler 3
3. Operating procedures
3.1. Loading CROSS
CROSS is run by typing the monitor command:
@CROSS ;tops20
.R CROSS ;tops10
3.2. Initial dialogue
When the assembler is ready to accept the user's command string, it types an
asterisk. The user must now type the command string on the same line.
The general form of the command string is:
binary output, listing output ← source input(s)
In addition, the command(s) may be stored in a file (default extension .CCL)
and read in by specifying:
@filename
Each input/output specification consists of the group:
dev:filnam.Ext[proj.,prog.]/switch:arg
- dev is:
DSK for disk
PTR for paper tape reader
PTP for high speed punch
TTY for the user's teletype
LPT for a queued line printer
- If not specified, the device is assumed to be the disk. Other system
devices may also be used, depending upon the system configuation.
- filnam is the file name of the appropriate file.
- ext is the file name extension for that file. If is not specified,
the assumptions are:
binary string: .BIN (absolute)
listing string: .LST
source string:
.M65 (MOS 6502)
.M68 (Motorola 6800)
.M80 (8080/Z80/8085)
.M88 (8008 , 8080 mnemonics)
Operation
CROSS-Microcomputer cross assembler 4
.M08 (8008 , Intel mnemonics)
.M18 (CPD1802 , COSMAC)
.MF8 (Fairchild F8) [future]
- [proj.,prog.] is the project-programmer number assigned for the disk
area to be used. If not specified, the user's local area is assumed.
Once specified, the number pair becomes the new default assumption
for the following files. (Use translate command on TOPS20) At CMU,
the CMU PPN format is accepted.
- Switches are specified by preceding each with a slash character.
Switch arguments are preceded by colons. In addition to explicit
specifications of the switches, a default set of switches may be
specified with a SWITCH.INI file (chapter 6, page 11).
/M65 source is 6502 code
/M68 source is 6800 code
/M80 source is 8080, 8085 or Z80 code
/M88 source is 8008 using 8080 compatible mnemonics
/M08 source is 8008 original Intel mnemonics
/M18 source is 1802 code (RCA COSMAC)
/MF8 source is Fairchild F8 [future]
/LI simulate .LIST directive (see chapter 4).
/NL simulate .NLIST directive (see chapter 4).
/EN simulate .ENABL directive (see chapter 5).
/DS simulate .DSABL directive (see chapter 5).
/CRF append cross reference table to the listing files
(see chapter 4).
/PTP binary output is ASCII coded hex
/N suppress error messages and expanded summary to the
teletype.
/OCT listing format in octal - hex is default
/I output binary in image mode (one byte per 36 bit
PDP-10 word). This switch must be used to copy
directly to paper tape.
/P pack binary output. This is the default case and the
switch is not needed.
/CDR simulate card reader input. This is actually
independent of the physical input device but causes
the assembler to ignore all characters on a column
after the 72nd.
/SOL sequence output lines (see chapter 4).
Operation
CROSS-Microcomputer cross assembler 5
/GNS generate new source (see chapter 4).
/NSQ suppress listing of PDP-10 style seq. Numbers.
/EQ equate the following symbols to zero. This is a
method for introducing conditional arguments without
creating special parameter tapes. "/EQ:sym1:sym2" is
the equivalent of the source statements "sym1=0" and
"sym2=0".
Operation
CROSS-Microcomputer cross assembler 6
4. Listing control
CROSS has two categories of listing controls: MACRO-11 compatible, which may
be specified either in source statements or in the command string, and a
superset which is limited to the command string.
4.1. Source statement listing control
Listings are controlled at source statement level through the use of the
.LIST and .NLIST directives. These are complementary in that any function
which can be enabled by a .LIST can be disabled by a .NLIST. To reduce
redundancy, the following descriptions will emphasize the .LIST while implying
the .NLIST complement.
The following are the allowable arguments for the .LIST directive along with
the default settings (li for .LIST and nl for .NLIST):
The first group controls intra-line listing. Suppression of any of these
will cause the assembler to utilize the space by moving the remainder of the
line over.
SEQ list the sequence numbers. These numbers represent the source
line numbers and are replaced by the nesting level in
parentheses for generated lines (macros, etc.).
LOC list the value of the location counter.
BIN list the binary code generated by the assembler.
SRC list the source statement. This is included primarily for
completeness.
COM list the comment field.
BEX list binary code which requires more than one listing line.
suppression of this is particularly useful in reducing the
length of listing required for long .ASCII strings.
The following arguments pertain to entire statements:
MB list macro binary and call only - no source
MD list macro definitions.
MC list macro calls.
ME -nl list macro expansions. The default causes the expansion to be
suppressed in the interest of supply economy. ME controls all
generated text (.MACRO's, .REPT's, and .IRP's).
Caution - due to their dual nature, .REPT's and .IRP's qualify
both as definitions and calls. CROSS treats MD and MC as a
pair in these cases, suppressing the listing if either is set.
CND list conditionals. Suppression causes unsatisfied conditionals
and all conditional directives (whether satisfied or not) to be
not listed.
SYM append a symbol table to the listing file.
TTM list in teletype format (one column of binary to a line,
truncation after 72 columns). Default setting is determined by
the output device specified: enabled if the physical device is
TTY: and disabled (line printer mode) in all other cases.
TOC-nl list a table of contents during pass one. This consists of the
.SBTTL directives being listed at the beginning of the listing
file. Each line consists of the line number and all text to
the right of the .SBTTL directive.
.LIST/.NLIST
CROSS-Microcomputer cross assembler 7
LD-nl list listing directives. Specifically, this causes all
.LIST/.NLIST directives which have no arguments to be listed.
its primary use is in debugging listing control.
.LIST and .NLIST directives with no arguments perform an over- ride function.
They control a listing "level" which is decremented for each .NLIST and
incremented for each .LIST. The level count is used as a three way switch:
1. Zero (initial condition): no special action.
2. Less than zero: unconditionally suppress the listing except for
lines containing errors.
3. Greater than zero: list unconditionally.
.LIST/.NLIST are normally paired to return the level count to zero. the
.NLIST/.LIST sequence is used to suppress a range which is normally listed,
while the .LIST/.NLIST sequence is used to over-ride a range which is normally
suppressed, such as in a macro expansion. The level count allows macro
expansions to use the listing control and return it to its previous state.
4.2. Command string equivalents
The command string contains the equivalent of all the above .LIST and .NLIST
functions as well as some that are not available at source level. Indeed, many
of the source level arguments are of primary interest at command string level
but can be used in the source to modify default settings.
The command string equivalents of .LIST and .NLIST are /LI and /NL,
respectively. Arguments are specified by preceding them with colons. Thus
/NL:bex:cnd is the equivalent of .NLIST CND,BEX.
In all cases, command string switches override their source level equivalents
(as well as previous occurrences in the command string). Effectively,
specification of a function in a command string will cause all its source level
equivalents (and their complements) to be ignored. i.e. /LI:me would enable
the listing of macro expansions and cause all ".LIST/.NLIST ME" directives to
be ignored.
/LI (no arguments) causes everything to be listed, while /NL suppresses the
listing of all but error lines, the symbol table, and the cross reference
tables.
4.3. Other listing controls
The following swithces are specified in output side of the command string by
preceding the mnemonic by a slash:
/OCT list in octal - default is hex
/N suppress error messages to the teletype (unless it is also the
listing device).
/CRF append a cross reference table to the listing file. Cross
accomplishes this in the following manner:
1. The listing file is generated in the normal way
during pass two, using the name specified by the
user.
2. Simultaneously, a temporary file (xxxCRF.TMP, where
xxx is the job number) is created. This contains
.LIST/.NLIST
CROSS-Microcomputer cross assembler 8
encoded cref information.
3. At the end of pass two, the temporary file is read
and the cref information is integrated into the
symbol table.
4. The references are appended to the listing file. if
insufficient core was available to build the table,
the process is repeated. When through, the
temporary file is deleted.
The cross reference table format is as follows:
1. The symbol itself.
2. Its symbol table value, unless .NLIST sym was
specified. Therefore the symbol table itself is
always pre-empted.
3. All references to the symbol, except that no more
than one reference to a given source line will be
listed. symbols in generated text always refer to
the previous source line.
4. Defining occurrences are flagged with a "#".
5. Destructive references are flagged with a "*".
These are defined to be all symbols encountered in
op-code fields which store into a memory location or
a register.
6. As many references per listing line as possible,
depending upon the "ttm" mode, are used. This can
be increased by suppressing "sym".
/SOL Sequence output lines. Listings are normally source oriented:
1. Sequence numbers reflect the source line number.
2. Macro expansion lines have their nesting level, in
parentheses, in the sequence number field.
3. Lines containing nothing but a form feed are not
listed but cause the sequence number to be
incremented.
4. Page numbers reflect physical input pages
(incremented only upon encountering a form feed).
Pages forced by the assembler have a -n to reflect
an extension page. i.e. If the assembler had
encountered 3 form feeds and was on its third
listing page since the last one, it would be "page
4-2".
when /SOL is specified, listings are output oriented:
1. Listed lines have consecutive numbers, except for
binary extensions.
.LIST/.NLIST
CROSS-Microcomputer cross assembler 9
2. Page numbers reflect the number of pages listed.
/GNS Generate a new source. This causes the listing file to take on
the appearance of a source file. specifically, it:
1. Suppresses the listing of headers, error flags,
summary blocks, and any other output over which the
user otherwise would have no control.
2. Simulates a /NL:seq:loc:bin:bex:me.
3. therefore, by itself, it recreates the source file.
Normal usage would have supplementary switches
following it. i.e. /gns/nl:md:mc /li:me would
replace macros, repeats, and irps by their generated
code, /gns/nl:cnd would purge conditionals, and
/gns/li:seq would be an expensive way of creating a
sequence numbered listing of the source file.
.LIST/.NLIST
CROSS-Microcomputer cross assembler 10
5. Enable/Disable control
As an alternative to the proliferation of directives, cross uses one
complementary pair, .ENABL/.DSABL, with arguments. Their command string
equivalents are /EN and /DS. The relationship between command string and
source statement specification, as well as their argument specification, is the
same as in .LIST/.NLIST.
M85 allow 8085 opcodes (RIM/SIM) in .M80 files
Z80 allow z80 opcodes in .M80 files
FPT floating point truncation. ".ENABL FPT" is equivalent to
".TRUNC" while ".DSABL FPT" is equivalent to ".ROUND".
ABS absolute assembly
AMA absolute memory addressing
NPP ".ENABL NPP" causes suppression of the output of the following
code, while ".DSABL NPP" causes its resumption.
ERF error flags can be selectively suppressed (or enabled) by
specifying ERF, directly followed by the selected error
characters. "/ds:erfzm" would cause "m" and "z" errors to be
ignored, "/ds:erf"would cause all errors to be ignored, and
"/en:erfa" would cause"a" flags (argument errors) to be
flagged.
LC lower case to upper case translation of input
LSB local symbol block
TIM timing information - causes number of states to be output on
the listing.
REG default register names
.ENABL/.DSABL
CROSS-Microcomputer cross assembler 11
6. User-defined switch defaults
CROSS is capable of accepting user-defined switch defaults. Any switches
that are valid in a command string may be specified in a special file called
SWITCH.INI. When cross is run, it will look for this file in the user's
directory. If the file is not found, then standard defaults (as defined
elsewhere in this document) are assumed. if SWITCH.INI is found, but no cross
switches are found, default settings are assumed.
To specify defaults, use the editor of your choice to create a file called
SWITCH.INI. This file must contain a line of the following format:
CROSS/switch1/switch2...../switchn
continuation lines are permitted. Specifically, a line containing a terminal
hyphen is assumed to be followed by a continuation line.
Of course CROSS does not consider the hyphen to be a part of any switch.
Note that this feature is a subset of the facility offered normally by use of
SWITCH.INI files.
SWITCH.INI
CROSS-Microcomputer cross assembler 12
I. 8080 syntax
I.1. Machine State
The registers for the 8080 are defined as:
- %A - the accumulator
- %B - register B
- %C - register C
- %D - register D
- %H - register H, high-order memory reference register
- %L - register L, low-order memory reference register
- %SP - the stack pointer register
- %PSW - the processor status, or F register
Register pairs are written in the description of each instruction by
concatenating two names, e.g., %H%L is the 16-bit value in the HL register
pair. Parentheses are sometimes added for visual clarity, e.g., ".(%H%L)".
The flags in the status register are represented by:
- c - the carry bit
- p - the parity bit. True if the last operation had odd parity, false
if even parity.
- z - the zero bit. True if the last operation had a zero result.
- s - the sign bit. True if the last operation had a negative result.
- ie - the interrupt enable flag.
In each description of an instruction that alters the condition codes, either
an explicit assignment is written (e.g., "c←0") or the condition codes are
listed in curly brackets. In this case, it is implied that c is set to
indicate carry or borrow (arithmentic operations), z is set if the result is
zero, s is set if the result is negative, and p is set if the parity is even.
I.2. Notation
To reduce the size of the description, several notational conventions will be
established for desribing the operands:
- i - represents an immediate operand which is 8 bits wide.
- m - represents a memory operand which is 16 bits wide.
- M - represents an implied memory operand addressed by the register
pair %H%L.
- MEM - represents all of addressible memory.
- DEV - represents all addressible devices.
- v - a special 3-bit value used for the RST instruction
- opnd - a general operand, either register or implied memory. For
registers, it will be expressed as %r for one of the 8-bit registers,
and for memory it will be expressed as M in the instruction syntax
and MEM[.(%H%L)] in the description of the instruction.
- %rp - a register pair from the set {%B%C, %D%E, %H%L %SP}. These
would be written, in the assembler, as %B, %D, %H or %SP.
- %rpn - a register pair from the set {%PSW, %A, %B%C, %D%E, %H%L}.
Written as %PSW, %B, %D or %H.
8080
CROSS-Microcomputer cross assembler 13
I.3. Opcodes
The opcodes that are recognized for the 8080 are shown below. The function
is given in a BLISS-like notation (the dot operator means "contents of").
ACI i %A ← .%A + i + .c; {c,z,s,p}
ADC opnd %A ← .%A + opnd + .c
ADD opnd %A ← .%A + .opnd; {c,z,s,p}
ADI i %A ← .%A + i; {c,z,s,p}
ANA opnd %A ← .%A and .opnd; c ← 0; {z,s,p}
ANI i %A ← .%A + i; c ← 0; {z,s,p}
CALL m MEM[.%SP-1], MEM[.%SP-1] ← .pc; %SP ← .%SP - 2; pc ← m;
CC m if .c then CALL m
CM m if .s then CALL m
CMA %A ← not .%A; {note: c,z,s,p not changed}
CMC c ← not .c
CMP opnd .%A - .opnd; {c,z,s,p}
CNC m if not .c then CALL m
CNZ m if not .z then CALL m
CP m if not .s then CALL m
CPE m if .p then CALL m
CPI i .%A - i; {c,z,s,p}
CPO m if not .p then CALL m
CZ m if .z then CALL m
DAA %A ← DecimalAdjust(.%A); {c,z,s,p}
DAD %B %H%L ← .(%H%L) + .(%B%C); {c}
DAD %D %H%L ← .(%H%L) + .(%D%E); {c}
DAD %SP %H%L ← .(%H%L) + .%SP; {c}
DCR opnd opnd ← .opnd - 1; {z,s,p}
DCX %rp %rp ← .(%rp) - 1
DI ie ← 0
EI ie← 1;
HLT
IN i %A ← .DEV[i];
INR opnd opnd ← .opnd + 1; {z,s,p}
INX %rp %rp ← .(%rp) + 1;
JC m if .c then pc ← m;
JM m if .s then pc ← m;
JMP m pc ← m;
JNC m if not .c then pc ← m;
JNZ m if not .z then pc ← m;
JP m if not .s then pc ← m;
JPE m if .p then pc ← m;
JPO m if not .p then pc ← m;
JZ m if .z then pc ← m;
LDA m %A ← .MEM[m];
LDAX %B %A ← .MEM[.(%B%C)];
LDAX %D %A ← .MEM[.(%D%E)];
LHLD m %H ← .MEM[m]; %L ← .MEM[m+1];
LXI %rp,m %rp ← m;
MOV %r1,%r2 %r1 ← .%r2;
MOV m,%r MEM[m] ← .%r;
MOV %r,m %r ← .MEM[m];
MVI opnd,i opnd ← i;
NOP ;
ORA opnd %A ← .%A or .opnd; c ← 0; {z,s,p}
ORI i {%A ← .%A or i;}; c ← 0; {z,s,p}
OUT i DEV[i] ← .%A;
PCHL pc ← .(%H%L);
8080
CROSS-Microcomputer cross assembler 14
POP %rpn %rpn ← .MEM[.%SP], .MEM[.%SP + 1]; %SP ← .%SP + 2;
PUSH %rpn %SP ← .%SP - 2; MEM[.%SP], MEM[.%SP + 1] ← .%rpn;
RAL c%A ← .(c%A) ↑ 1;
RAR c%A ← .(c%A) ↑ -1;
RC if .c then RET;
RET pc ← .MEM[.%SP], .MEM[.%SP+1]); %SP←.%SP + 2;
RLC c ← .%A<7,1>; %A ← .%A ↑ 1
RM if .s then RET;
RNC if not .c then RET;
RNZ if not .z then RET;
RP if not .s then RET;
RPE if .p then RET;
RPO if not .p then RET;
RRC c ← .%A<0,1>; %A ← .%A ↑ -1;
RST v CALL v ↑ 8;
RZ if .z then RET;
SBB opnd %A ← .%A - .opnd - .c; {c,z,s,p}
SBI i %A ← .%A - i - .c; {c,z,s,p}
SHLD m MEM[m] ← .%H; MEM[m+1] ← .%L;
SPHL %sp ← .(%H%L);
STA m MEM[m] ← .%A;
STAX %B MEM[.(%B%C)] ← .%A;
STAX %D MEM[.(%D%E)] ← .%A;
STC c ← 1;
SUB opnd %A ← .%A - .opnd; {c,z,s,p}
SUI i %A ← .%A - i; {c,z,s,p}
XCHG %D <=> %H; %E <=> %L;
XRA opnd %A ← .%A xor .opnd; c ← 0; {z,s,p}
XTHL MEM[.%SP - 1] <=> %H; MEM[.%SP] <=> %L;
8080
CROSS-Microcomputer cross assembler 15
II. Z80 syntax
II.1. Introduction
The Z80 portion of CROSS is not intended to correspond to the Zilog syntax;
instead, it is treated as an extension of the 8080 operations described in
section I. This means that new opcode designators have been invented where
appropriate.
II.2. Machine State
The Z80 registers are designated exactly like the 8080 registers, with the
following additions:
- %X - index register X (16 bits)
- %Y - index register Y (16 bits)
- iv - the interrupt vector base address (8 bits)
- ra - the dynamic RAM refresh address (8 bits)
II.3. Notation
The following notational extensions are made to the 8080 description:
- b - A bit position, 0-7, for bit operations
- opnd - In addition to %r and M, indexed operands are permitted for
all instructions which use opnd; these are expressed to the assembler
as d(X) or d(Y), where d is an 8-bit displacement. In the
description, they are interpreted as ".%X+d" or ".%Y+d".
- %rpx - Register pair including %X, i.e., {%B%C, %D%E, %X, %SP}
- %rpy - Register pair including %Y, i.e., {%B%C, %D%E, %Y, %SP}
II.4. Opcodes
The extended opcodes for the Z80 are given below. Those which are underlined
are mnemonics which are neither 8080 instructions nor those defined by Zilog
for the Z80; they have been invented for CROSS. A complete transliteration
from Zilog assembler format to CROSS syntax is given in section II.5.
BIT b,opnd z ← not .opnd<b,1>
CCD .%A - .MEM[.(%H%L)]; %H%L ← .(%H%L) - 1; %BC ← .(%B%C) - 1;
{z,s,p}
CCDR until .%A = .MEM[.(%H%L)] or .(%B%C) = 0 do begin
.%A - .MEM[.(%H%L)]; %H%L ← .(%H%L) - 1; %B%C ← .(%B%C) - 1
end; {c,z,p}
CCI .%A - .MEM[.(%H%L)]; %H%L ← .(%H%L) + 1; %BC ← .(%B%C) - 1;
{z,s,p}
CCIR until .%A = .MEM[.(%H%L)] or .(%B%C) = 0 do begin
.%A - .MEM[.(%H%L)]; %H%L ← .(%H%L) + 1; %B%C ← .(%B%C) - 1
end; {c,z,p}
CNO CPO;
CO CPE;
DADC %rp %HL ← .(%HL) + .%rp + .c; {c,z,n,p}
DADX %rpy %X ← .%X + .%rpy; {c,n}
DADY %rpx %Y ← .%Y + .%rpx; {c,n}
DJNZ i if .%B 0 then pc ← .pc + 2 + i
DSBC %rp %H%L ← .%H%L - .%rp - .c; n ← 1; p ← 0; {c,z}
Z80
CROSS-Microcomputer cross assembler 16
EXAF %A%PSW <=> %A'%PSW';
EXX %B%C <=> %B'%C'; %D%E <=> %D'%E'; %H%L <=> %H'%L'
IM0 im ← 0;
IM1 im ← 1;
IM2 im ← 2;
IND
INDR
INI
INIR
INP
JMPR i pc ← .pc + 2 + i;
JNO m JPO m;
JO m JPE m;
JRC i if .c then JR i;
JRNC i if not .c then JR i;
JRNZ i if not .z then JR i;
JRZ i if .z then JR i;
LBCD m %B%C ← .MEM[m];
LDAI %A ← .iv;
LDAR %A ← .ra;
LDD MEM[.(%D%E)] ← .MEM[.(%H%L)]; %D%E ← .(%D%E) - 1;
%H%L ← .(%H%L) - 1; %B%C ← .(%B%C) - 1; n ← 0;
LDDR until .(%B%C) = 0 do begin MEM[.(%D%E)] ← .MEM[.(%H%L)];
%D%E ← .(%D%E) - 1; %H%L ← .(%H%L) - 1; %B%C ← .(%B%C) - 1;
end;
LDED m %D%E ← .MEM[m];
LDI .MEM[.(%D%E)] ← .MEM[.(%H%L)]; %D%E ← .(%D%E) + 1;
%H%L ← .(%H%L) + 1; %B%C ← .(%B%C) - 1; {p}
LDIR until .(%B%C) = 0 do begin MEM[.(%D%E)] ← .MEM[.(%H%L)];
%D%E ← .(%D%E) + 1; %H%L ← .(%H%L) + 1; %B%C ← .(%B%C) - 1;
end;
LIXD m %X ← .MEM[m+1], .MEM[m];
LIYD m %Y ← .MEM[m+1], .MEM[m];
LSPD m %SP ← .MEM[m+1], .MEM[m];
NEG %A ← - .%A; p ← 0; {c,z,s}
OUTD
OUTDR
OUTI
OUTIR
OUTP
PCIX pc ← .%X;
PCIY pc ← .%Y;
RALR
RARR
RES b,opnd %opnd<b,1> ← 0;
RETI return from interrupt
RETN return from nonmaskable interrupt
RLCR
RLD decimal arithmetic
RNO RPO;
RO RPE;
RRCR
RRD decimal arithmetic
SBCD m MEM[m] ← .(%B%C);
SDED m MEM[m] ← .(%D%E);
SET b,opnd opnd<b,1> ← 1;
SIXD m MEM[m] ← .%X;
SIYD m MEM[m] ← .%Y;
Z80
CROSS-Microcomputer cross assembler 17
SLAR
SPIX %SP ← .%X;
SPIY %SP ← .%Y;
SRAR
SRLR
SSPD m MEM[m] ← .%SP;
STAI iv ← .%A;
STAR ra ← .%A;
XTIX %X <=> MEM[.%SP];
XTIY %Y <=> MEM[.%SP];
II.5. Z80 Transliterations
The following transliterations are necessary because of the differences
between the Zilog definition of the instructions and the CROSS syntax. This is
indexed alphabetically by the Zilog operations in order to facilitate
translation of Zilog assembly programs to CROSS.
Zilog Cross
ADC i ACI i
ADC (HL) ADC M
ADC HL,rp DADC %rp
ADC (IX+d) ADC d(X)
ADC (IY+d) ADC d(Y)
ADC r ADC %r
ADD i ADI i
ADD (HL) ADD M
ADD HL,rp DAD %rp
ADD (IX+d) ADD d(X)
ADD (IY+d) ADD d(Y)
ADD r ADD %r
AND i ANI i
AND (HL) ANA M
AND (IX+d) ANA d(X)
AND (IY+d) ANA d(Y)
AND r ANA %r
BIT b,(HL) BIT b,M
BIT b,(IX+d) BIT b,d(X)
BIT b,(IY+d) BIT b,d(Y)
CALL m CALL m
CALL C,m CC m
CALL M,m CM m
CALL NC,m CNC m
CALL NZ,m CNZ m
CALL NZ,m CNZ m
CALL P,m CP m
CALL PE,m CPE m
CALL PO,m CPO m
CALL Z,m CZ m
CCF CMC
CP i CPI i
CP (HL) CMP M
CP (IX+d) CMP d(X)
CP (IY+d) CMP d(Y)
CP r CMP %r
CPD CCD
CPDR CCDR
CPI CCI
CPIR CCIR
CPL CMA
Z80 transliterations
CROSS-Microcomputer cross assembler 18
DAA DAA
DEC (HL) DCR M
DEC IX DCX %X
DEC IY DCX %Y
DEC (IX+d) DCR d(X)
DEC (IY+d) DCR d(Y)
DEC rp DCX %rp
DEC r DCR %r
DI DI
DJNZ d DJNZ d
EI EI
EX AF,AF' EXAF
EX DE,HL XCHG
EX (SP),HL XTHL
EX (SP),IX XTIX
EX (SP),IY XTIY
EXX EXX
HALT HLT
IM 0 IM0
IM 1 IM1
IM 2 IM2
IN A,i IN i
IN r,(c)
INC (HL) INR M
INC IX INX %X
INC IY INX %Y
INC (IX+d) INR d(X)
INC (IY+d) INR d(Y)
INC rp INX %rp
IND IND
INDR INDR
INI INI
INIR INIR
JP m JMP m
JP M,m JM m
JP NC,m JNC m
JP NZ,m JNZ m
JP NZ,m JNZ m
JP P,m JP m
JP PE,m JPE m
JP PO,m JPO m
JP Z,m JZ m
JR d JMPR d
JR NC,m JRNC m
JR NZ,m JRNZ m
JR NZ,m JRNZ m
JR Z,m JRZ m
LD A,(m) LDA m
LD A,(BC) LDAX %B
LD A,(DE) LDAX %D
LD A,i MVI %A,i
LD A,r MOV %A,%r
LD (m),A STA m
LD (m),BC SBCD m
LD (m),DE SDED m
LD (m),HL SHLD m
LD (m),IX SIXD m
LD (m),IY SIYD m
Z80 transliterations
CROSS-Microcomputer cross assembler 19
LD (m),SP SSPD m
LD (BC),A STAX %B
LD (DE),A STAX %D
LD HL,(m) LHLD m
LD (HL),i MVI i
LD (HL),r MOV %r,M
LD I,A STAI
LD IX,(m) LIXD m
LD IX,m LXI %X,m
LD (IX+d),i MVI i,d(X)
LD (IX+d),r MOV %r,d(X)
LD IY,(m) LIYD m
LD IY,m LXI %Y,m
LD (IY+d),i MVI i,d(Y)
LD (IY+d),r MOV %r,d(Y)
LD r,A MOV %r,%A
LD r,i MVI %r,i
LD r,(HL) MOV %r,M
LD r,(IX+d) MOV %r,d(X)
LD r,(IY+d) MOV %r,d(Y)
LD r,r MOV %r,%r
LD BC,(m) LBCD m
LD DE,(m) LDED m
LD HL,(m) LHLD m
LD SP,(m) LSPD m
LD IX,(m) LIXD m
LD IY,(m) LIYD m
LD rp,m LXI %rp,m
LD SP,HL SPHL
LD SP,IX SPIX
LD SP,IY SPIY
LDD LDD
LDDR LDDR
LDI LDI
LDIR LDIR
NEG NEG
NOP NOP
OR i ORI i
OR (HL) ORA M
OR (IX+d) ORA d(X)
OR (IY+d) ORA d(Y)
OR r ORA %r
OUT (i),r
OUT i,A OUT i
OUTD OUTD
OUTDR OUTDR
OUTI OUTI
OUTIR OUTIR
POP IX POP %X
POP IY POP %Y
POP rp POP %rp
PUSH IX PUSH %X
PUSH IY PUSH %Y
PUSH rp PUSH %rp
RES b,(HL) RES b,M
RES b,(IX+d) RES b,d(X)
RES b,(IY+d) RES b,d(Y)
RES b,r RES b,%r
Z80 transliterations
CROSS-Microcomputer cross assembler 20
RET RET
RET M RM
RET NC RNC
RET NZ RNZ
RET NZ RNZ
RET P RP
RET PE RPE
RET PO RPO
RET Z RZ
RETI RETI
RETN RETN
RL (HL) RALR M
RL (IX+d) RALR d(X)
RL (IY+d) RALR d(Y)
RL r RALR %r
RLA RAL
RLC (HL) RLC M
RLC (IX+d) RLC d(X)
RLC (IY+d) RLC i<d>(Y)
RLC r RLC %r
RLCA RLC
RLD RLD
RR (HL) RARR M
RR (IX+d) RARR d(X)
RR (IY+d) RARR d(Y)
RR r RARR %r
RRA RAR
RRC (HL) RRC M
RRC (IX+d) RRC d(X)
RRC (IY+d) RRC d(Y)
RRC r RRC %r
RRCA RRC
RRD RRD
RST v RST v
SBC i SBI i
SBC (HL) SBC M
SBC HL,rp DSBC %rp
SBC (IX+d) SBC d(X)
SBC (IY+d) SBC d(Y)
SBC r SBC %r
SCF STC
SET b,(HL) SET b,M
SET b,(IX+d) SET b,d(X)
SET b,(IY+d) SET b,d(Y)
SET b,r SET b,%r
SLA (HL) SLAR M
SLA (IX+d) SLAR d(X)
SLA (IY+d) SLAR d(Y)
SLA r SLAR %r
SRA (HL) SRAR M
SRA (IX+d) SRAR d(X)
SRA (IY+d) SRAR d(Y)
SRA r SRAR %r
SUB i SUI i
SUB (HL) SUB M
SUB (IX+d) SUB d(X)
SUB (IY+d) SUB d(Y)
SUB r SUB %r
Z80 transliterations
CROSS-Microcomputer cross assembler 21
XOR i XRI i
XOR (HL) XRA M
XOR (IX+d) XRA d(X)
XOR (IY+d) XRA d(Y)
XOR r XRA %r
Z80 transliterations
CROSS-Microcomputer cross assembler 22
III. 8008
The 8008 is described by two different sets of opcodes. The one set is based
upon the 8080 style of coding, and is a subset of the operations. The other
set is based upon the original set of 8008 mnemonics as described by Intel.
Rather than give complete descriptions of these operations, the user is
referred back to the 8080 descriptions. What this section will give is a
listing of the available operations and a cross reference to the original 8008
mnemonics.
Note that the 8008 is "software compatible" with the 8080; the same mnemonics
will produce different bit patterns for the 8008 and the 8080.
III.1. 8080 subset
The instructions which are implemented for the 8008 are:
ACI ADC ADD ADI ANA ANI CALL CC
CM CMP CNC CNZ CP CPE CPI CPO
CZ DCR HLT IN INR JC JM JMP
JNC JNZ JP JPE JPO JZ MOV
MVI NOP ORA ORI OUT RAL RAR
RC RET RET RLC RM RNC RNZ
RP RPE RPO RRC RST RZ SBB
SBI SUB SUI XRA XRI
The set of original 8008 operations are defined as:
8080 Original 8008
ADC ACA, ACB, ACC, ACD, ACE, ACH, ACL
ACI ACI
ADD ADA, ADB, ADC, ADD, ADE, ADH, ADL
ADI ADI
CALL CAL
CNC CFC
CPO CFP
CM CFS
CNZ CFZ
CMP CPA, CPB, CPC, CPD, CPE, CPH, CPL
CPI CPI
CC CTC
CPE CTP
CP CTS
CZ CTZ
DCR DCB, DCC, DCD, DCE, DCH, DCL
HLT HLT
INR INB, INC, IND, INE, INH, INL
IN INP
JNC JFC
JNZ JFZ
JPO JFP
JM JFS
JMP JMP
JC JTC
JPE JTP
JP JTS
JZ JTZ
MOV LAA, LAB, LAC, LAD, LAE, LAH, LAL, LAM, LBA, LBB, LBC, LBD,
LBE, LBH, LBL, LBM, LCA, LCB, LCC, LCD, LCE, LCH, LCL, LCM,
LDA, LDB, LDC, LDD, LDE, LDH, LDL, LDM, LEA, LEB, LEC, LED,
8008
CROSS-Microcomputer cross assembler 23
LEE, LEH, LEL, LEM, LHA, LHB, LHC, LHD, LHE, LHH, LHL, LHM,
LLA, LLB, LLC, LLD, LLE, LLH, LLL, LLM
MVI LAI, LBI, LCI, LDI, LEI, LHI, LLI, LMI
ANA NDA, NDB, NDC, NDD, NDE, NDH, NDL, NDM
ANI NDI
NOP NOP
ORA ORA, ORB, ORC, ORD, ORE, ORH, ORL, ORM
ORI ORI
OUT OUT
RAL,RAR RAL, RAR
RET RET
RNC RFC
RPO RFP
RP RFS
RNZ RFZ
RLC,RRC RLC, RRC
SUB SBA, SBB, SBC, SBD, SBE, SBH, SBL, SBM
SBI SBI
SBC SUA, SUB, SUC, SUD, SUE, SUH, SUL, SUM
SUI SUI
XRA XRA, XRB, XRC, XRD, XRE, XRH, XRL, XRM
8008
CROSS-Microcomputer cross assembler 24
IV. 1802
IV.1. Machine State
D The data register
DF The "data flag" register, or carry
P 4-bit program counter pointer
X 4-bit data counter pointer
T 8-bit buffer for P and X
Q Q-status output register
IV.2. Opcodes
The operation codes recognized for the 1802 are:
ADC D ← .mem[.R[.X]] + .D + .DF
ADCI D ← data8 + .D + .DF
ADD D ← .mem[.R[.X]] + .D
ADI D ← data8 + .D
AND
ANI
BDF if .DF then R[P]<7,0> ← adr8
BGE
BL
BM
BNF
BNQ
BNZ
BN1
BN2
BN3
BN4
BPZ
BQ
BR
BZ
B1
B2
B3
B4
DEC n R[n] ← .R[n] - 1;
DIS
GHI
GLO
IDL
INC n R[n ← .R[n] + 1;
INP
IRX
LBDF
LBNF
LBNQ
LBNZ
LBQ
LBR
1802
CROSS-Microcomputer cross assembler 25
LBZ
LDA
LDI
LDN
LDX
LDXA
LSDF
LSIE
LSKP
LSNF
LSNQ
LSNZ
LSQ
LSZ
MARK
NBR
NLBR
NOP
OR
ORI
OUT
PHI
PLO
REQ
RET
RSHL
RSHR
SAV
SD
SDB
SDBI
SDI
SEP
SEQ
SEX
SHL
SHLC
SHR
SHRC
SKP
SM
SMB
SMBI
SMI
STR
STXD
XOR
XRI
1802
CROSS-Microcomputer cross assembler 26
V. 6502
V.1. Machine state
The machine state is represented by:
- c - The carry bit
- z - The zero bit, true if result was zero
- v - The overflow bit
- s - The sign bit, true if result was negative
- d - Decimal mode
- i - Interrupt disable bit; 0 => interrupts enabled
- b - Breakpoint flag; set by BRK instruction trap
The machine registers are:
- ac - The single accumulator, 8 bits wide
- x - 8 bit index register x, preindexes indirect addresses
- y - 8 bit index register y, postindexes indirect addresses.
- sp - 8 bit stack pointer.
- psw - 8 bit processor status word.
V.2. Notation
The operands are expressed as:
- opnd8 - 8 bit operand corresponding to one of the form:
* addr - Base page direct (8 bit address).
* addr,X - Base page indexed by x; MEM[addr + .x].
* (addr,X) - Indexed indirect by x; (.MEM[addr + .x]).
* (addr),Y - Indexed indirect by y; (.MEM[addr] + .y).
- opnd16 - Any of the following operands in the form:
* addr - Extended direct (16 bit address); MEM[addr].
* addr,X - Absolute indexed via x; MEM[addr + .x].
* addr,Y - Absolute indexed via y; MEM[addr + .y].
- opnd - Either opnd8 or opnd16.
- i - Immediate data, expressed as #expression.
6502
CROSS-Microcomputer cross assembler 27
V.3. Syntax
The syntax for operands is much like that specified by MOS Technology.
Immediate operands are indicated by preceding the operand with a hash mark, #.
V.4. Opcodes
The opcodes recognized for the Mos Technology 6502 are:
ADC opnd ac ← .ac + .opnd + .c; {s,z,c,v}
ADC i ac ← .ac + i + .c; {s,z,c,v}
AND opnd ac ← .ac and .opnd; {s,z}
AND i ac ← .ac and i; {s,z}
ASL opnd c,opnd ← opnd ↑ 1; {s,z,c}
BCC d if not .c then pc ← .pc + 1 + d;
BCS d if .c then pc ← .pc + 1 + d;;
BEQ d if .z then pc ← .pc + 1 + d;;
BIT opnd .ac and .opnd; s ← (.ac and .opnd)<7,1>;
v ← (.ac and .opnd)<6,1>; {z}
BMI d if .s then pc ← .pc + 1 + d;;
BNE d if not .z then pc ← .pc + 1 + d;;
BPL d if not .s then pc ← .pc + 1 + d;;
BRK MEM[.sp] ← .pc<0,8>; MEM[.sp + 1] ← .pc<8,8>;
MEM[.sp + 2] ← .psw; sp ← .sp - 3; pc ← $FFFFFFFE; i ← 1;
b ← 1;
BVC d if not .v then pc ← .pc + 1 + d;;
BVS d if .v then pc ← .pc + 1 + d;;
CLC c ← 0;
CLD d ← 0;
CLI i ← 0;
CLV v ← 0;
CMP opnd .ac - .opnd; {s,z,c}
CPX opnd .x - .opnd; {s,z,c}
CPY opnd .y - opnd; {s,z,c}
DEC ac ← .ac - 1; {s,z}
DEX x ← .x - 1; {s,z}
DEY y ← .y - 1; {s,z}
EOR opnd ac ← .ac - .opnd
INC ac ← .ac + 1; {z,s}
INX x ← .x + 1;
INY y ← .y + 1;
JMP m pc ← m;
JSR m MEM[.sp] ← .pc<8,8>; MEM[.sp - 1] ← .pc<0,8>; sp ← .sp - 2;
pc ← m;
LDA opnd ac ← .opnd; {s,z}
LDX opnd x ← .opnd; {s,z}
LDY opnd y ← .opnd; {s,z}
LSR ac,c ← .ac,0 ↑ -1;
NOP ;
ORA opnd ac ← .ac or opnd; {s,z}
PHA MEM[.sp] ← .ac; sp ← .sp - 1;
PHP MEM[.sp] ← .psw; sp ← .sp - 1;
PLA ac ← .MEM[.sp + 1]; sp ← .sp + 1;
PLP psw ← .MEM[.sp + 1]; sp ← .sp + 1;
ROL opnd c,.MEM[opnd] ← c,.MEM[opnd] rot 1; {s,z,c}
ROR opnd c,.MEM[opnd] ← c,.MEM[opnd] rot -1; {s,z,c}
RTI psw ← .MEM[.sp + 1]; pc<0,8> ← .MEM[.sp + 2];
pc<8,8> ← .MEM[.sp + 3]; sp ← .sp + 3; pc ← .pc + 1;
RTS pc<0,8> ← .MEM[.sp + 1]; pc<8,8> ← .MEM[.sp + 2]; sp ← .sp + 2;
pc ← .pc + 1;
6502
CROSS-Microcomputer cross assembler 28
SBC opnd ac ← .ac - .opnd - (not .c); {s,z,c,v}
SEC c ← 1;
SED d ← 1;
SEI i ← 1;
STA opnd MEM[opnd] ← .ac; {s,z}
STX opnd MEM[opnd] ← .x; {s,z}
STY opnd MEM[opnd] ← .y; {s,z}
TAX a ← .x;
TAY a ← .y;
TSX sp ← .x;
TXA x ← .a;
TXS x ← .sp;
TYA y ← .a;
6502
CROSS-Microcomputer cross assembler 29
VI. 6800
VI.1. Machine State
The registers are:
- %A - accumulator A
- %B - accumulator B
- %X - Index register (16 bits)
- sp - Stack pointer (16 bits)
- pc - The program counter (16 bits)
The flags are:
- c - Carry
- o - Overflow
- s - Sign
- z - Zero
- xc - Auxiliary carry
VI.2. Notation
- mem - A memory address which can be one of
* Base page direct (.MEM[mem], mem 8 bits)
* Extended direct (MEM[mem], mem 16 bits)
* Indexed (MEM[mem+.%X], mem 8 bits)
- memd - A memory address which can be one one of
* Extended direct (MEM[memd], memd 16 bits)
* Indexed (MEM[memd+.%X], memd 8 bits)
- i - An immediate operand, written as #i
- i16 - A 16-bit immediate operand, written as #i16
- d - A displacement, usually written as an address; CROSS will compute
the actual displacement between the current instruction and the
destination address.
- opnd - A general operand; may be either mem or i. When interpreted
as a value, ".opnd" may represent either .MEM[mem] or i. Please
excuse the somewhat sloppy notation; it makes the description more
compact.
- sr - The status register which holds c,z,s,o,xc.
6800
CROSS-Microcomputer cross assembler 30
VI.3. Syntax
Immediate operands are written with a # symbol, e.g.
ADDA #$F9 ; Adds hex F9 to A
Indexing is specified by writing ",X" after the operand. The operand must be
a value which will fit in 8 bits.
foo==$10
ADDA foo,X
VI.4. Opcodes
ABA %A ← .%A + .%B; {c,z,s,o,xc}
ADCA opnd %A ← .%A + .opnd + .c; {c,z,s,o,xc}
ADCB opnd %B ← .%B + .opnd + .c; {c,z,s,o,xc}
ADDA opnd %A ← .%A + .opnd; {c,z,s,o,xc}
ADDB opnd %B ← .%b + .opnd; {c,z,s,o,xc}
ANDA opnd %A ← .%A + .opnd; o←0; {z,s}
ANDB opnd %B ← .%B + .opnd; o←0; {z,s}
ASL memd c←.memd<7,1>; memd←.memd↑1; o←.s xor .c; {z,s}
ASLA c←.%A<7,1>; %A←.%A↑1; o←.s xor .c; {z,s}
ASLB c←.%B<7,1>; %B←.%B↑1; o←.s xor .c; {z,s}
ASR memd c←.memd<0,1>; memd←.memd ash -1; o←.s xor .c; {z,s}
ASRA c←.%A<0,1>; %A←.%A ash -1; o←.s xor .c; {z,s}
ASRB c←.%B<0,1>; %B←.%B ash -1; o←.s xor .c; {z,s}
BCC d if not .c then BRA d;
BCS d if .c then BRA d;
BEQ d if .z then BRA d;
BGE d if not (.o xor .s) then BRA d;
BGT d if not (.z or (.s xor .o)) then BRA d;
BHI d if not (.c or .z) then BRA d;
BITA mem .%A and .mem; o ← 0; {z,s}
BITB mem .b and .mem; o ← 0; {z,s}
BLE d if .z or (.s xor .o) then BRA d;
BLS d if .c or .z then BRA d;
BLT if .s xor .o then BRA d;
BMI d if .s then BRA d;
BNE d if not .z then BRA d;
BPL d if not .s then BRA d;
BR d BRA d;
BRA d pc ← .pc + 2 + d;
BSR d MEM[.sp] ← .pc<0,8>; MEM[.sp - 1] ← .pc<8,8>; sp ← .sp - 2;
pc ← .pc + d + 2;
BVC d if not .o then BRA d;
BVS d if .o then BRA d;
CBA .%A - .%B; {c,z,s,o}
CLC c←0;
CLI ie ← 0;
CLR memd memd←0; c←0; z←1; s←0; o←0;
CLRA %A ← 0; c←0; z←1; s←0; o←0;
CLRB %B ← 0; c←0; z←1; s←0; o←0;
CLV o ← 0;
CMPA opnd .%A - .opnd; {c,z,s,o}
CMPB opnd .%B - .opnd; {c,z,s,o}
COM memd memd←?4.memd; c←1; o←0; {s,z}
COMA %A←?4.%A; c←1; o←0; {s,z}
COMB %B←?4.%B; c←1; o←0; {s,z}
6800
CROSS-Microcomputer cross assembler 31
CPX memd %X<0,8>-.(memd+1); %X<8,8>-.memd; {s,z,o}
DAA decimal arithmetic
DEC memd memd←.memd-1; {s,z,o}
DECA %A ← .%A - 1; {s,z,o}
DECB %B ← .%B - 1; {s,z,o}
DES sp ← .sp - 1;
DEX %X ← .%X - 1; {z}
EORA opnd %A←%A xor .opnd; o←0; {s,z}
EORB opnd %B←%B xor .opnd; o←0; {s,z}
INC memd memd←.memd+1; {s,z,o}
INCA %A ← .%A + 1; {s,z,o}
INCB %B ← .%B + 1; {s,z,o}
INS sp ← .sp + 1;
INX %x ← .%X + 1; {z}
JMP mem pc ← mem;
JSR mem MEM[.sp]←.pc<0,8>; MEM[.sp-1]←.pc<8,8>; sp←.sp-2; pc←mem;
LDAA
LDAB
LDS mem sp<8,8> ← .mem; sp<0,8> ← .(mem + 1); o ← 0; {z,s}
LDS i16 sp ← i16; {s,z}
LDX opnd %X<8,8> ← .opnd; %X<0,8> ← .(opnd + 1); o ← 0; {z,s}
LSRA
LSRB
NEG memd memd ← 0 -.memd; {c,s,z,o}
NEGA %A ← 0 - .%A; {c,s,z,o}
NEGB %B ← 0 - .%B; {c,s,z,o}
NOP ;
ORAA
ORAB
PSHA
PSHB
PULA
PULB
ROL
ROLA
ROLB
ROR
RORA
RORB
RTI
RTS
SBA %A ← .%A - .%B; {c,z,s,o}
SBCA opnd %A ← %A - .opnd - .c; {c,z,s,o}
SBCB opnd %B ← .%B - .opnd - .c; {c,z,s,o}
SEC c ← 1;
SEI ie ← 1;
SEV o ← 1;
STAA
STAB
STS mem mem ← .sp<8,8>; (mem + 1) ← .sp<0,8>; o←0; {s,z}
STX mem mem ← .%X<8,8>; (mem + 1) ← .%X<0,8>; o←0; {s,z}
SUBA opnd %A ← .%A - .opnd; {c,s,z,o}
SUBB opnd %B ← .%B - .opnd; {c,s,z,o}
SWI software interrupt
TAB %B ← .%A; o←0; {s,z}
TAP sr ← .%A; {c,z,s,o,xc}
TBA %A ← .%B; o←0; {s,z}
TPA %A ← .sr
6800
CROSS-Microcomputer cross assembler 32
TST memd c ← 0; z ← .memd = 0; s ← .memd < 0; o ← 0;
TSTA c ← 0; z ← .%A = 0; s ← .%A < 0; o ← 0;
TSTB c ← 0; z ← .%B = 0; s ← .%B < 0; o ← 0;
TSX %X ← .sp + 1;
TXS sp ← .%X - 1;
WAI MEM[.sp]←.pc<0,8>; MEM[.sp-1]←.pc<8,8>; MEM[.sp-2]←.%X<0,8>;
MEM[.sp-3]←%X<8,8>; MEM[.sp-4]←.%A; MEM[.sp-5]←.%B;
MEM[.sp-6]←.sr; sp←.sp-7;
6800
CROSS-Microcomputer cross assembler 33
VII. Compiler directives
The following compiler directives and their presumed meanings are described
briefly here. This is only a refresher for those who have read the DEC
assembler description.
.ABS Compile non-relocatable (absolute) code.
.ADDR Generates a 16-bit address with the bytes in the proper order,
i.e., <low> <high>.
.ASCII ASCII string delimited by paired markers.
.ASCIZ ASCIZ string delimited by paired markers and supplied with
terminal null byte.
.ASECT Begin an absolute (non-relocatable) control section.
.BLKB Allocate space for a number of bytes as specified by the
operand.
.BLKW Allocate space for a number of words as specified by the
operand.
.BYTE Each expression supplied will be stored in a single byte.
.CSECT Enter a Csect.
.DEPHA Dephase; leave .PHASE control area.
.DSABL See chapter 5.
.ENABL See chapter 5.
.END End of program.
.ENDC End of conditional; paired with .IF.
.ENDM End of macro definition or repeat; paired with .MACRO, .IRP,
.IRPC, .REPT.
.ENDR End of repetition; paired with .REPT; equivalent to .ENDM in
this context.
.EOT End-of-tape; assembler will wait for next tape to be loaded
(paper tape hackers only).
.EQUIV ?
.ERROR x;text Causes an error message to be issued. The optional expression
x is evaluated and output if present.
.FLT2 ?
.FLT4 ?
.GLOBL ?
.IF Enter a conditional.
Compiler directives
CROSS-Microcomputer cross assembler 34
.IFDF .IFDF <symbol> true if symbol is defined. See also .IFNDF.
.IFEQ .IFEQ <expression> true if expression evaluates to zero.
.IFF Begins body of conditional if enclosing condition was false.
.IFG .IFG <expression> true if expression greater than zero.
.IFGE .IFG <expression> true if expression greater than or equal to
zero.
.IFGT Same as .IFG
.IFL .IFL <expression> true if expression is negative.
.IFLE .IFLE <expression> true if expression is negative or zero.
.IFLT Same as .IFL.
.IFNDF .IFNDF <symbol> true if symbol is undefined.
.IFNE .IFNE <expression> true if expression is non-zero.
.IFNZ Same as .IFNE
.IFT Begins body of conditional if enclosing condition was true.
.IFTF Text from here to the next .IFT, .IFF or .IFTF or the end of
the conditional will be included independent of the value of
the condition of the enclosing conditional.
.IFZ Same as .IFE
.IIF condition, arg, stmnt
Immediate if; if condition is met, stmnt is emitted.
.IRP sym,<arglist> Indefinite repeat of body based upon number of parameters in
<arglist>.
.IRPC sym,<str> Indefinite repeat of body based upon number of characters in
<str>.
.LIMIT Reserves two words into which are put the lower and upper
boundaries of the code.
.LIST Enable listing.
.LOCAL ?
.MACRO name <arglist>
Begin a macro definition
.MCALL Call macros from the system library.
.MEXIT Leave macro expansion
Compiler directives
CROSS-Microcomputer cross assembler 35
.NARG sym The symbol is equated to the number of arguments to the macro
.NCHR sym,<str> The symbol is equated to the number of characters in <str>
.NLIST Turn off listing
.NTYPE sym,arg The symbol is equated to the addressing mode of the argument.
.PAGE Force a page break
.PDP10 Irrelevant
.PHASE Assemble code as if it were located according to the argument
of this directive.
.PRINT Print the text which follows on the terminal.
.PSECT
.RADIX Change the radix to the value specified to this directive.
.RAD50 Each argument is converted to a radix50 representation,
whatever that means for a microcomputer.
.REM
.REPT (.REPT <n>) Repeat the body of this directive the indicated
number of times.
.ROUND Perform arithmetic operations with rounding to integer result
(see also .TRUNC).
.SBTTL Specify subtitle text.
.TITLE Specify title text.
.TRUNC Perform arithmetic operations with truncation to integer result
(see also .ROUND)
.WORD Allocate space for each value specified. Each expression
evaluates to a word (16 bits).
Compiler directives
CROSS-Microcomputer cross assembler 36
VIII. Macro quick summary
? When specified with a formal, will cause a compiler-generated
symbol to be provided if an actual is not given in that
position.
' Internal concatenation character
\<expr> When used as an argument, evaluates <expr> before performing
the actual-formal match.
Macro summary
CROSS-Microcomputer cross assembler 37
IX. Assembler syntax quick summary
<...> Encloses any expression (the assembler's equivalent of
parentheses). Expressions are evaluated left-to-right without
operator heirarchy.
+ Addition or unary plus
- Subtraction or unary minus
* Multiplication
/ Division
& Logical and
! Logical or
; Begins comment field
' Indicates single ASCII character as a term in expressions.
↑O Indicates octal number
↑B Indicates binary number
= Symbol assignment
. Current location counter
$ Indicates hexadecimal number
% Indicates binary number (6502/6800 mode only)
↑ If a postfix operator, divides the expression by 256.
Assembler summary
CROSS-Microcomputer cross assembler 38
Index
! 37
#, in cref 8
$<expr> 1, 37
%<expr> 1, 37
%nn, register 1
& 37
', concatenation 36, 37
* 37
*, in cref 8
+ 37
- 37
., location counter 37
.ABS 33
.ADDR 33
.ASCII 33
.ASCIZ 33
.ASECT 33
.BLKB 33
.BLKW 33
.BYTE 33
.CSECT 33
.DEPHAse 33
.DSABL 4, 10, 33
.ENABL 4, 10, 33
.END 33
.ENDC 33
.ENDM 33
.ENDR 33
.EOT 33
.EQUIV 33
.ERROR 33
.FLT2 33
.FLT4 33
.GLOBL 33
.IF 33
.IFDF 33
.IFEQ 34
.IFF 34
.IFG 34
.IFGE 34
.IFGT 34
.IFL 34
.IFLE 34
.IFLT 34
.IFNDF 34
Index
CROSS-Microcomputer cross assembler 39
.IFNE 34
.IFNZ 34
.IFT 34
.IFTF 34
.IFZ 34
.IIF 34
.IRP 34
.IRPC 34
.LIMIT 34
.LIST 4, 6, 7, 34
.LOCAL 34
.MACRO 34
.MCALL 34
.MEXIT 34
.NARG 34
.NCHR 35
.NLIST 4, 6, 7, 35
.NTYPE 35
.PAGE 35
.PDP10 35
.PHASE 35
.PRINT 35
.PSECT 35
.RAD50 35
.RADIX 35
.REM 35
.REPT 35
.ROUND 10, 35
.SBTTL 35
.TITLE 35
.TRUNC 10, 35
.WORD 35
/ 37
/CDR 4
/CRF 4, 7
/DS 4, 10
/EN 4, 10
/EQ 5
/GNS 4, 9
/I 4
/LI 4, 7
/M08 4
/M18 4
/M65 4
/M68 4
/M80 4
/M88 4
/MF8 4
/N 4, 7
/NL 4, 7
/NSQ 5
/OCT 4, 7
/P 4
/PTP 4
/SOL 4, 8
1802 4, 24
Index
CROSS-Microcomputer cross assembler 40
6502 4, 26
6800 4, 29
72, column 4
8008 4, 22
8080 4, 12
8085 4
;, comment delimiter 37
<...> 37
= 37
?, macro argument modifier 36
@, in command 3
@<expr> 1
ABS 10
.ABS 33
Absolute memory addressing 10
.ADDR 33
AMA 10
And, assembler operator 37
.ASCII 33
.ASCIZ 33
.ASECT 33
BEX, listing option 6
BIN, extension 3
BIN, listing option 6
Binary listing option 6
Binary radix 1
.BLKB 33
.BLKW 33
.BYTE 33
Byte, high 1
Card reader simulation 4
CCL file 3
/CDR 4
CND, listing option 6
COM, listing option 6
Command line 3
Comment delimiter 37
Comment listing option 6
Concatenation operator 36, 37
Conditional compilation: .IF 33
Conditional listing option 6
Contents, listing option 6
COSMAC 1802 4, 24
/CRF 4, 7
CRF.TMP file 7
Cross-reference 4
.CSECT 33
Index
CROSS-Microcomputer cross assembler 41
Current location counter 37
Decimal radix 1
.DEPHAse 33
/DS 4, 10
.DSABL 4, 10, 33
DSK, device 3
/EN 4, 10
.ENABL 4, 10, 33
.END 33
.ENDC 33
.ENDM 33
.ENDR 33
.EOT 33
/EQ 5
.EQUIV 33
ERF 10
.ERROR 33
Error flags, suppression 10
Error message suppression 4
Extension .BIN 3
Extension .CCL 3
Extension .LST 3
Extension .M08 3
Extension .M18 4
Extension .M65 3
Extension .M68 3
Extension .M80 3
Extension .M88 3
Extension .MF8 4
F8 4
Fairchild F8 4
Floating point truncation 10
.FLT2 33
.FLT4 33
FPT 10
Generate new source 4, 9
.GLOBL 33
/GNS 4, 9
Hex output 4
Hexidecimal radix 1
High byte 1
/I 4
.IF 33
.IFDF 33
.IFEQ 34
.IFF 34
.IFG 34
.IFGE 34
.IFGT 34
.IFL 34
.IFLE 34
.IFLT 34
Index
CROSS-Microcomputer cross assembler 42
.IFNDF 34
.IFNE 34
.IFNZ 34
.IFT 34
.IFTF 34
.IFZ 34
.IIF 34
Image mode output 4
Intel 8008 4, 22
Intel 8080 4, 12
Intel 8085 4
.IRP 34
.IRPC 34
LC 10
LD, listing option 6
/LI 4, 7
.LIMIT 34
Line numbers 4
.LIST 4, 6, 7, 34
Listing option BEX 6
Listing option BIN 6
Listing option CND 6
Listing option COM 6
Listing option LD 6
Listing option LOC 6
Listing option MB 6
Listing option MC 6
Listing option MD 6
Listing option ME 6
Listing option SEQ 6
Listing option SRC 6
Listing option SYM 6
Listing option TOC 6
Listing option TTM 6
LOC, listing option 6
.LOCAL 34
Location counter 37
Lower case 10
LPT, device 3
LSB 10
LST, extension 3
/M08 4
M08, extension 3
/M18 4
M18, extension 4
/M65 4
M65, extension 3
/M68 4
M68, extension 3
/M80 4
M80, extension 3
M85 10
/M88 4
M88, extension 3
.MACRO 34
Macro call listing option 6
Index
CROSS-Microcomputer cross assembler 43
Macro definition 34
Macro, concatenation 36, 37
MB, listing option 6
MC, listing option 6
.MCALL 34
MD, listing option 6
ME, listing option 6
Memory addressing, absolute 10
.MEXIT 34
MF8 4
MF8, extension 4
MOS 6502 4, 26
Motorola 6800 4, 29
/N 4, 7
.NARG 34
.NCHR 35
New source, generation 4, 9
/NL 4, 7
.NLIST 4, 6, 7, 35
/NPP 10
/NSQ 5
.NTYPE 35
/OCT 4, 7
Octal radix 1, 4
Or, assembler operator 37
Output format 4
/P 4
Packed binary output 4
.PAGE 35
.PDP10 35
.PHASE 35
.PRINT 35
.PSECT 35
/PTP 4
PTP, device 3
PTR, device 3
.RAD50 35
.RADIX 35
Radix 16 1
Radix 2 1
Radix 8 1, 4
Radix, 10 1
Radix, binary 1
Radix, decimal 1
Radix, default 1
Radix, hexidecimal 1
Radix, octal 1
RCA 1802 4, 24
REG 10
Register %nn 1
.REM 35
.REPT 35
RIM, opcode 10
.ROUND 10, 35
Index
CROSS-Microcomputer cross assembler 44
.SBTTL 35
SEQ, listing option 6
SIM, opcode 10
/SOL 4, 8
Source listing option 6
Source, new, generation 4, 9
SRC, listing option 6
Suppression of error flags 10
Switch CDR 4
Switch CRF 4, 7
Switch DS 4, 10
Switch EN 4, 10
Switch EQ 5
Switch GNS 4, 9
Switch I 4
Switch LI 4, 7
Switch M08 4
Switch M18 4
Switch M65 4
Switch M68 4
Switch M80 4
Switch M88 4
Switch N 4, 7
Switch NL 4, 7
Switch NPP 10
Switch NSQ 5
Switch OCT 4, 7
Switch P 4
Switch PTP 4
Switch SOL 4, 8
SWITCH.INI 11
SYM, listing option 6
Symbol table listing option 6
Table of contents, listing option 6
Teletype format listing option 6
TIM 10
.TITLE 35
TOC, listing option 6
.TRUNC 10, 35
Truncation 10
TTM, listing option 6
TTY, device 3
.WORD 35
Z80 4, 10, 15
Z80 transliteration 17
Zilog Z80 4, 15
\, macro argument modifier 36
↑, <expr>↑ 1, 37
↑B<expr> 1, 37
↑O<expr> 1, 37
Index
CROSS-Microcomputer cross assembler i
Table of Contents
1. Introduction 1
2. Syntax differences 2
3. Operating procedures 3
3.1. Loading CROSS 3
3.2. Initial dialogue 3
4. Listing control 6
4.1. Source statement listing control 6
4.2. Command string equivalents 7
4.3. Other listing controls 7
5. Enable/Disable control 10
6. User-defined switch defaults 11
I. 8080 syntax 12
I.1. Machine State 12
I.2. Notation 12
I.3. Opcodes 13
II. Z80 syntax 15
II.1. Introduction 15
II.2. Machine State 15
II.3. Notation 15
II.4. Opcodes 15
II.5. Z80 Transliterations 17
III. 8008 22
III.1. 8080 subset 22
IV. 1802 24
IV.1. Machine State 24
IV.2. Opcodes 24
V. 6502 26
V.1. Machine state 26
V.2. Notation 26
V.3. Syntax 27
V.4. Opcodes 27
VI. 6800 29
Index
CROSS-Microcomputer cross assembler ii
VI.1. Machine State 29
VI.2. Notation 29
VI.3. Syntax 30
VI.4. Opcodes 30
VII. Compiler directives 33
VIII. Macro quick summary 36
IX. Assembler syntax quick summary 37
Index 38
Index